using System;
using System.Threading;
using System.Collections.Generic;
using XiaoweiV2.ResponseDataTypes;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using VoiceAI;

namespace XiaoweiVoiceAI.ResponseCreators
{
    internal static class DefaultResponseCreator
    {
        private class DefaultResponseData : IResponseData
        {
            public ResponseType ResponseType => ResponseType.Default;

            public ErrorCode ErrorCode { get; set; } = ErrorCode.NoError;

            public string RequestText { get; set; } = "";

            public string ResponseText { get; set; } = "";

            public string TTSUrl { get; set; } = "";

            public bool RestoreInHistory { get; set; } = true;
            public object DataContext { get; set; }
        }
        public static IResponseData CreateResponseData(XiaoweiVoiceAI xiaoweiVoiceAI, XiaoweiV2.ResponseParam param)
        {

            DefaultResponseData defaultResponseData = new DefaultResponseData();
            defaultResponseData.ResponseText = param.ResponseText;
            defaultResponseData.RequestText = param.RequestText;
            defaultResponseData.TTSUrl= XiaoweiV2.ResponseHelper.GetTTSUrl(param);
            if(string.IsNullOrEmpty(param.RequestText))
            {
                defaultResponseData.RestoreInHistory = false;
            }
            return defaultResponseData;
        }
    }
}
